package myTest.sort;

import java.io.File;
import java.io.FileInputStream;
import java.io.FileOutputStream;
import java.util.Properties;

class PropTest {
	public static void main(String[] args) throws Exception {
		File f = new File("/home/chenwei/Documents//ha.p");
		if (!f.exists())
			f.createNewFile();
		int count = 0;
		Properties prop = new Properties();
		FileInputStream fis = new FileInputStream(f);
		FileOutputStream fos = new FileOutputStream(f);
		prop.load(fis);
		fis.close();
		String value = prop.getProperty("count");
		if (value != null) {
			count = Integer.parseInt(value);
			if (count >= 5) {
				System.out.println("您好，该程序已经使用到期，请续费");
				System.exit(0);
			}
		}
		count++;
		prop.setProperty("count", count + "");

		prop.store(fos, "");
		fos.close();
		System.out.println("done");
	}
}